
clear all
set more off, perm
capture log close
set maxvar 32767
global klmChinaReach2: env klmChinaReach2
global datapath "${klmChinaReach2}\Fuyao_Erlfang"

******language
cd "$datapath\estimates\maturation\Graphs\l"

use l_add, clear
// replace var1 = subinstr(var1, "Level ", "", .)
// destring var1, replace
// rename level levelc2 
*kbar
// replace var_ub_ = add_pe + 1.96*var_sd_
// replace var_lb_ = add_pe - 1.96*var_sd_

preserve 
keep if var == "Kbar"
label var var_ub_ "95% CI"
label var add_pe "Minimum Skill Requirement"
twoway scatter add_pe level, sort lwidth(medthick) msize(medium) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medthick)   ///
	xlabel(2(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle(Kbar, size(small)) ylabel(,labsize(small)) ///
	title("Minimum Latent Language Skills Requirement by Level", size(medium)) subtitle(Additive Model w/ Scale Invariance, size(small)) legend(order(1 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "All the children started from level 2 or above upon enrolling." "The value at Level 2 is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_kbar", replace)
	graph export "add_kbar.pdf", replace
restore


preserve 
keep if var != "Kbar" & var != "Delta"
label var var_ub_ "95% CI"
label var add_pe "{&sigma}{sup:2}({&epsilon},l)"
// foreach i in mul_pe var_lb_ var_ub_{
// 	replace `i' = ln(`i')
// }
replace var_lb_ = . if add_pe > 30
replace var_ub_ = . if add_pe > 30
replace add_pe = . if add_pe > 30

twoway scatter add_pe level, sort lwidth(medthick) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medthick) cmissing(n)  ///
	xlabel(3(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	title("Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Language)", size(medium)) subtitle(Additive Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "The variance with values over 30 are dropped to better visualize the estimates for the rest levels," "and their confidence intervals are not shown." "All the children started from level 2 or above upon enrolling." "The value at Level 2 is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_sigma_30", replace)
	graph export "add_sigma_30.pdf", replace	
restore	
	
	
**log version
preserve 
keep if var != "Kbar" & var != "Delta"
label var var_ub_ "95% CI"
label var add_pe "{&sigma}{sup:2}({&epsilon},l)"
foreach i in add_pe var_lb_ var_ub_{
	replace `i' = ln(`i')
}
// replace var_lb_ = . if mul_pe > 30
// replace var_ub_ = . if mul_pe > 30
// replace mul_pe = . if mul_pe > 30

twoway scatter add_pe level, sort lwidth(medthick) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medthick) cmissing(n)  ///
	xlabel(3(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("log({&sigma}{sup:2}({&epsilon},l))", size(small)) ylabel(,labsize(small)) ///
	title("Log of Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Language)", size(medium)) subtitle(Additive Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "Log values are shown in figures to better visualize the values for all difficulty levels." "All the children started from level 2 or above upon enrolling." "The value at Level 2 is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_sigma", replace)
	graph export "add_sigma.pdf", replace	
restore	


**mul
**# mul_si

use "l_mul", clear
// replace var_ub_ = mul_pe + 1.96*var_sd_
// replace var_lb_ = mul_pe - 1.96*var_sd_
*kbar
preserve 
keep if var == "Kbar"
label var var_ub_ "95% CI"
label var mul_pe "Minimum Skill Requirement"
twoway scatter mul_pe level, sort lwidth(medthick) msize(medium) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medthick)  ///
	xlabel(3(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle(Kbar, size(small)) ylabel(,labsize(small)) ///
	title("Minimum Latent Language Skills Requirement by Level", size(medium)) subtitle(Multiplicative Model w/ Scale Invariance, size(small)) legend(order(1 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "All the children started from level 2 or above upon enrolling." "The value at Level 2 is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_kbar", replace)
	graph export "mul_kbar.pdf", replace
restore


preserve 
keep if var != "Kbar" & var != "Delta"
label var var_ub_ "95% CI"
label var mul_pe "{&sigma}{sup:2}({&epsilon},l)"
// foreach i in mul_pe var_lb_ var_ub_{
// 	replace `i' = ln(`i')
// }
replace var_lb_ = . if mul_pe > 30
replace var_ub_ = . if mul_pe > 30
replace mul_pe = . if mul_pe > 30

twoway scatter mul_pe level, sort lwidth(medthick) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medthick) cmissing(n)  ///
	xlabel(3(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	title("Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Language)", size(medium)) subtitle(Multiplicative Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "The variance with values over 30 are dropped to better visualize the estimates for the rest levels," "and their confidence intervals are not shown." "All the children started from level 2 or above upon enrolling." "The value at Level 2 is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_sigma_30", replace)
	graph export "mul_sigma_30.pdf", replace	
restore	
	
	
**log version
preserve 
keep if var != "Kbar" & var != "Delta"
label var var_ub_ "95% CI"
label var mul_pe "{&sigma}{sup:2}({&epsilon},l)"
foreach i in mul_pe var_lb_ var_ub_{
	replace `i' = ln(`i')
}
// replace var_lb_ = . if mul_pe > 30
// replace var_ub_ = . if mul_pe > 30
// replace mul_pe = . if mul_pe > 30

twoway scatter mul_pe level, sort lwidth(medthick) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medthick) cmissing(n)  ///
	xlabel(3(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("log({&sigma}{sup:2}({&epsilon},l))", size(small)) ylabel(,labsize(small)) ///
	title("Log of Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Language)", size(medium)) subtitle(Multiplicative Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "Log values are shown in figures to better visualize the values for all difficulty levels." "All the children started from level 2 or above upon enrolling." "The value at Level 2 is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_sigma", replace)
	graph export "mul_sigma.pdf", replace	
restore	
	

	


**# add_wo

use l_add_wo_si, clear

preserve 
keep if var == "Kbar"
label var var_ub_ "95% CI"
label var add_pe "Minimum Skill Requirement"
twoway scatter add_pe level, sort lwidth(medthick) msize(medium) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medthick)   ///
	xlabel(2(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle(Kbar, size(small)) ylabel(,labsize(small)) ///
	title("Minimum Latent Language Skills Requirement by Level", size(medium)) subtitle(Additive Model w/ Scale Invariance, size(small)) legend(order(1 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "All the children started from level 2 or above upon enrolling." "The value at Level 2 is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_kbar_wo", replace)
	graph export "add_kbar_wo.pdf", replace
restore


preserve 
keep if var != "Kbar" & var != "Delta"& var != "Beta1"
label var var_ub_ "95% CI"
label var add_pe "{&sigma}{sup:2}({&epsilon},l)"
// foreach i in mul_pe var_lb_ var_ub_{
// 	replace `i' = ln(`i')
// }
replace var_lb_ = . if add_pe > 30
replace var_ub_ = . if add_pe > 30
replace add_pe = . if add_pe > 30

twoway scatter add_pe level, sort lwidth(medthick) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medthick) cmissing(n)  ///
	xlabel(3(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	title("Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Language)", size(medium)) subtitle(Additive Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "The variance with values over 30 are dropped to better visualize the estimates for the rest levels," "and their confidence intervals are not shown." "All the children started from level 2 or above upon enrolling." "The value at Level 2 is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_sigma_30_wo", replace)
	graph export "add_sigma_30_wo.pdf", replace	
restore	
	
	
**log version
preserve 
keep if var != "Kbar" & var != "Delta"& var != "Beta1"
label var var_ub_ "95% CI"
label var add_pe "{&sigma}{sup:2}({&epsilon},l)"
foreach i in add_pe var_lb_ var_ub_{
	replace `i' = ln(`i')
}
// replace var_lb_ = . if mul_pe > 30
// replace var_ub_ = . if mul_pe > 30
// replace mul_pe = . if mul_pe > 30

twoway scatter add_pe level, sort lwidth(medthick) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medthick) cmissing(n)  ///
	xlabel(3(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("log({&sigma}{sup:2}({&epsilon},l))", size(small)) ylabel(,labsize(small)) ///
	title("Log of Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Language)", size(medium)) subtitle(Additive Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "Log values are shown in figures to better visualize the values for all difficulty levels." "All the children started from level 2 or above upon enrolling." "The value at Level 2 is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_sigma_wo", replace)
	graph export "add_sigma_wo.pdf", replace	
restore	


preserve 
keep if var == "Beta1"
label var var_ub_ "95% CI"
label var add_pe "{&beta}{sub:1}"
twoway connected add_pe level, sort lwidth(medthick) msize(medium) || line var_ub_ level, sort lcolor(gs11) lpattern(dash) lwidth(medthick) || line var_lb_ level, sort lcolor(gs11) lpattern(dash) lwidth(medthick)   ///
	xlabel(2(1)11, labsize(small)) xmtick(, labsize(small)) yline(1, lcolor(khaki) lwidth(medthick)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&beta}{sub:1}", size(small)) ylabel(,labsize(small)) ///
	title("Transformation Function Slope ({&beta}{sub:1,l}) by Level (Language)", size(large)) subtitle(Additive Model w/o Scale Invariance, size(medium)) legend(order(1 2) row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
note("Note: The confidence interval is based on 1,000 iteration bootstrap." "All the children started from level 2 or above upon enrolling.", size(small) span)   ///	
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_beta1", replace)
	graph export "add_beta1.pdf", replace
restore	



**# mul_wo


use "l_mul_wo_si", clear
// replace var_ub_ = mul_pe + 1.96*var_sd_
// replace var_lb_ = mul_pe - 1.96*var_sd_
*kbar
preserve 
keep if var == "Kbar"
label var var_ub_ "95% CI"
label var mul_pe "Minimum Skill Requirement"
twoway scatter mul_pe level, sort lwidth(medthick) msize(medium) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medthick)  ///
	xlabel(3(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle(Kbar, size(small)) ylabel(,labsize(small)) ///
	title("Minimum Latent Language Skills Requirement by Level", size(medium)) subtitle(Multiplicative Model w/ Scale Invariance, size(small)) legend(order(1 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "All the children started from level 2 or above upon enrolling." "The value at Level 2 is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_kbar_wo", replace)
	graph export "mul_kbar_wo.pdf", replace
restore


preserve 
keep if var != "Kbar" & var != "Delta"& var != "Beta1"
label var var_ub_ "95% CI"
label var mul_pe "{&sigma}{sup:2}({&epsilon},l)"
// foreach i in mul_pe var_lb_ var_ub_{
// 	replace `i' = ln(`i')
// }
replace var_lb_ = . if mul_pe > 30
replace var_ub_ = . if mul_pe > 30
replace mul_pe = . if mul_pe > 30

twoway scatter mul_pe level, sort lwidth(medthick) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medthick) cmissing(n)  ///
	xlabel(3(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	title("Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Language)", size(medium)) subtitle(Multiplicative Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "The variance with values over 30 are dropped to better visualize the estimates for the rest levels," "and their confidence intervals are not shown." "All the children started from level 2 or above upon enrolling." "The value at Level 2 is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_sigma_30_wo", replace)
	graph export "mul_sigma_30_wo.pdf", replace	
restore	
	
	
**log version
preserve 
keep if var != "Kbar" & var != "Delta"& var != "Beta1"
label var var_ub_ "95% CI"
label var mul_pe "{&sigma}{sup:2}({&epsilon},l)"
foreach i in mul_pe var_lb_ var_ub_{
	replace `i' = ln(`i')
}
// replace var_lb_ = . if mul_pe > 30
// replace var_ub_ = . if mul_pe > 30
// replace mul_pe = . if mul_pe > 30

twoway scatter mul_pe level, sort lwidth(medthick) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medthick) cmissing(n)  ///
	xlabel(3(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("log({&sigma}{sup:2}({&epsilon},l))", size(small)) ylabel(,labsize(small)) ///
	title("Log of Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Language)", size(medium)) subtitle(Multiplicative Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "Log values are shown in figures to better visualize the values for all difficulty levels." "All the children started from level 2 or above upon enrolling." "The value at Level 2 is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_sigma_wo", replace)
	graph export "mul_sigma_wo.pdf", replace	
restore	
	

preserve 
 replace var_ub_ = mul_pe + 1.96*var_sd_
 replace var_lb_ = mul_pe - 1.96*var_sd_


keep if var == "Beta1"
label var var_ub_ "95% CI"
label var mul_pe "{&gamma}{sub:1}"
twoway connected mul_pe level, sort lwidth(medthick) msize(medium) || line var_ub_ level, sort lcolor(gs11) lpattern(dash) lwidth(medthick) || line var_lb_ level, sort lcolor(gs11) lpattern(dash) lwidth(medthick)   ///
	xlabel(2(1)11, labsize(small)) xmtick(, labsize(small)) yline(1, lcolor(khaki) lwidth(medthick))  ///
	xtitle(Difficulty Level, size(small)) ytitle("{&gamma}{sub:1,l}", size(small)) ylabel(,labsize(small)) ///
	title("Transformation Function Slope ({&gamma}{sub:1,l}) by Level (Language)", size(large)) subtitle(Multiplicative Model w/o Scale Invariance, size(medium)) legend(order(1 2) row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on standard error." "All the children started from level 2 or above upon enrolling.", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_beta1_sd", replace)
	graph export "mul_beta1_sd.pdf", replace
restore	


		
	
**# lan eta_delta


use eta_delta_l_add, clear
label var m_eta_1_ "Fast"
label var m_eta_2_ "Normal"
label var m_eta_3_ "Slow"
label var ul_1_ "95% CI"
twoway connected m_eta_1_ level, sort lwidth(medthick) msize(medium) mc(navy) lcolor(navy) lpattern(dash)|| rcap ul_1_ ll_1_ level, sort lcolor(gs12) lwidth(medthick) || connected m_eta_2_ level, sort msize(medium) m(S) mc(olive) lcolor(olive)  lpattern(dash) || rcap ul_2_ ll_2_ level, sort lcolor(gs12) lwidth(medthick) || connected m_eta_3_ level, sort msize(medium) m(T) mc(orange) lcolor(orange)  lpattern(dash) || rcap ul_3_ ll_3_ level, sort lcolor(gs12) lwidth(medthick)  ///
	xlabel(2(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle({&delta}(l)E({&eta}), size(small)) ylabel(,labsize(small)) ///
	title(Learning Component ({&delta}(l)E({&eta})) by Difficulty Level (Language), size(med)) subtitle(by Ability Group, size(medsmall)) legend(order(1 3 5 2 "95% CI") row(1) size(vsmall) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("1. Fast group: the child can pass the first task at over 80% of the difficulty levels, and the average pass rate at that level is greater than 80%." "Normal group: the child doesn't pass the first task, and the pass rate is greater than 50%; or the child passes the first task, and the pass rate is" "between 50% and 80%. Slow group: the average pass rate is less than 50%.    2. 95% confidence intervals are shown for three groups." "3. All the children started from level 2 or above upon enrolling.", size(vsmall) span) ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_deltaeta", replace)
	graph export "add_deltaeta.pdf", replace
	


use eta_delta_l_mul, clear


label var m_eta_1_ "Fast"
label var m_eta_2_ "Normal"
label var m_eta_3_ "Slow"
label var ul_1_ "95% CI"
// twoway scatter m_eta_1_ level, sort lwidth(medthick) msize(medium) mc(navy) lcolor(navy) lpattern(dash)|| rcap ul_1_ ll_1_ level, sort lcolor(gs12) lwidth(medthick) || scatter m_eta_2_ level, sort msize(medium) m(S) mc(olive) lcolor(olive)  lpattern(dash) || rcap ul_2_ ll_2_ level, sort lcolor(gs12) lwidth(medthick) || scatter m_eta_3_ level, sort msize(medium) m(T) mc(orange) lcolor(orange)  lpattern(dash) || rcap ul_3_ ll_3_ level, sort lcolor(gs12) lwidth(medthick)  ///
twoway connected m_eta_1_ level, sort lwidth(medthick) msize(medium) mc(navy) lcolor(navy) lpattern(dash)|| rcap ul_1_ ll_1_ level, sort lcolor(gs12) lwidth(medthick) || connected m_eta_2_ level, sort msize(medium) m(S) mc(olive) lcolor(olive)  lpattern(dash) || rcap ul_2_ ll_2_ level, sort lcolor(gs12) lwidth(medthick) || connected m_eta_3_ level, sort msize(medium) m(T) mc(orange) lcolor(orange)  lpattern(dash) || rcap ul_3_ ll_3_ level, sort lcolor(gs12) lwidth(medthick)  ///
	xlabel(2(1)11, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle({&delta}(l)E({&eta}), size(small)) ylabel(,labsize(small)) ///
	title(Learning Component ({&delta}(l)E({&eta})) by Difficulty Level (Language), size(med)) subtitle(by Ability Group, size(medsmall)) legend(order(1 3 5 2 "95% CI") row(1) size(vsmall) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("1. Fast group: the child can pass the first task at over 80% of the difficulty levels, and the average pass rate at that level is greater than 80%." "Normal group: the child doesn't pass the first task, and the pass rate is greater than 50%; or the child passes the first task, and the pass rate is" "between 50% and 80%. Slow group: the average pass rate is less than 50%.    2. 95% confidence intervals are shown for three groups." "3. All the children started from level 2 or above upon enrolling.", size(vsmall) span) ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_deltaeta", replace)
	graph export "mul_deltaeta.pdf", replace	
	
		
		